using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using FrameWorkSystem.BusinessLayer.DataLayer;

namespace FrameWorkSystem.BusinessLayer
{
    public class Sys_last_code_idFactory
    {

        #region data Members

        Sys_last_code_idSql _dataObject = null;

        #endregion

        #region Constructor

        public Sys_last_code_idFactory()
        {
            _dataObject = new Sys_last_code_idSql();
        }

        #endregion


        #region Public Methods
        public bool Insert(Sys_last_code_id businessObject)
        {
            if (!businessObject.IsValid)
            {
                //(businessObject.BrokenRulesList.ToString());
            }


            return _dataObject.Insert(businessObject);

        }
        public bool Update(Sys_last_code_id businessObject)
        {
            if (!businessObject.IsValid)
            {
                //(businessObject.BrokenRulesList.ToString());
            }


            return _dataObject.Update(businessObject);
        }
     
        public Sys_last_code_id GetByPrimaryKey(Sys_last_code_idKeys keys)
        {
            return _dataObject.SelectByPrimaryKey(keys); 
        }

        /// <summary>
        /// get list of all Sys_last_code_ids
        /// </summary>
        /// <returns>list</returns>
        public List<Sys_last_code_id> GetAll()
        {
            return _dataObject.SelectAll(); 
        }

        /// <summary>
        /// get list of Sys_last_code_id by field
        /// </summary>
        /// <param name="fieldName">field name</param>
        /// <param name="value">value</param>
        /// <returns>list</returns>
        public List<Sys_last_code_id> GetAllBy(Sys_last_code_id.Sys_last_code_idFields fieldName, object value)
        {
            return _dataObject.SelectByField(fieldName.ToString(), value);  
        }

        /// <summary>
        /// delete by primary key
        /// </summary>
        /// <param name="keys">primary key</param>
        /// <returns>true for succesfully deleted</returns>
        public bool Delete(Sys_last_code_idKeys keys)
        {
            return _dataObject.Delete(keys); 
        }

        /// <summary>
        /// delete Sys_last_code_id by field.
        /// </summary>
        /// <param name="fieldName">field name</param>
        /// <param name="value">value</param>
        /// <returns>true for successfully deleted</returns>
        public bool Delete(Sys_last_code_id.Sys_last_code_idFields fieldName, object value)
        {
            return _dataObject.DeleteByField(fieldName.ToString(), value); 
        }

        #endregion

    }
}
